Skip to content

Treat narrowing conversion as warning, not error #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2018

Conversation

PaulStoffregen
Copy link
Contributor

Fix for arduino/Arduino#7944

Before the upgrade to gcc 5.4, this was treated as a non-fatal warning (when warnings are enabled). Now some libraries fail to compile. This simply restores the gcc 4.8 & 4.9 behavior.

Copy link
Collaborator

@matthijskooijman matthijskooijman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I do wonder if we need some kind of mechanism or preference to disable this kind of compatibility fixes, so users and library authors can opt-in on getting the most thorough checking of their code, but that's probably a different discussion.

@PaulStoffregen
Copy link
Contributor Author

PaulStoffregen commented Aug 31, 2018

This doesn't remove the message. It still shows as warning messages, just not errors.

The problem is so many library authors never change Arduino default to suppress all warnings, so they never know their code has warnings.

I believe arduino-builder could implement some logic to detect if timestamps on library files are newer than the sketch source, or newer than other stuff (maybe the library.properties or src folder or....) the idea would be to detect when someone is editing the library files rather than just using a freshly installed copy. It's the library is being edited, maybe turn on all warnings. Doing this might improve the library quality across the entire Arduino ecosystem over time?

@facchinm
Copy link
Member

I believe arduino-builder could implement some logic to detect if timestamps on library files are newer than the sketch source, or newer than other stuff (maybe the library.properties or src folder or....) the idea would be to detect when someone is editing the library files rather than just using a freshly installed copy. It's the library is being edited, maybe turn on all warnings. Doing this might improve the library quality across the entire Arduino ecosystem over time?

Wow, this is a very clever idea! One very simple first step could be activating warnings by default on libraries that are actually versioned (contain a .git folder? )

@cmaglie cmaglie merged commit 1db33d2 into arduino:master Sep 3, 2018
@PaulStoffregen PaulStoffregen deleted the narrowing_warning branch September 3, 2018 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants